Metamodel generation on the basis of examples of target models

ABSTRACT

The present invention relates to a method, system and computer program product for generating a metamodel representing a desired modeling environment. The said metamodel is generated on the basis of examples of target models, comprising extracting information required to construct the metamodel, from said examples, and generating a metamodel structure that represents the class of models that all the examples collectively represent.

FIELD OF THE INVENTION

[0001] The present invention relates to generating a metamodel that is configurable for any one of several similar modeling environments, characterized in that said metamodel is generated on the basis of examples of target models.

BACKGROUND OF THE INVENTION

[0002] An overview of normal modeling systems largely in use, is first presented, followed by the limitations of such systems. An overview of Metamodeling systems is then presented, and how it overcomes the limitations. Finally a note on the focus of the current work is made.

[0003] As shown in FIG. 1, conventional-modeling tools (1.1) present the user (1.2) with a graphical user interface (1.1 a), and allow him to develop specific models that the software is designed for. For example, a database modeling tool allows the user to create entity-relationship models, while an OOP CASE tool allows the user to create class diagrams, sequence diagrams, collaboration diagrams etc. These systems are built with the knowledge (1.1 b) of the types of models (1.3) that the tool will allow the user to develop. Thus, each tool can support a known limited set of models.

[0004] Limitations of such systems include:

[0005] 1. If there are changes in the way the models are created, the knowledge embedded in the software has to be updated. Since this knowledge is an inherent part of the software, this needs modification of the code, recompilation and possibly re-linking, before the software is rendered for use with the required modifications.

[0006] 2. There could be a need to support variations in the way in which the models are created. For example, the workflow modeling done by company A could be different from the way Company B does it. It depends on the particular company and their specific needs, although both of them are basically doing the same activity, namely, defining workflow for business processes.

[0007] Metamodeling tools remedy the above limitations by providing a system which . . .

[0008] a. Allows the user to configure the modeling system with a modeling environment, which constitutes a metamodel (or definitions), describing the kinds of models that can be created by the tool.

[0009] b. Once the modeling system is configured for a particular modeling environment, it allows the user to create models that are instances of the metamodel (i.e., the models that are created by the user should conform to the definitions provided). The modelling environment can be changed whenever desired, and the model immediately conforms to the new modelling environment.

[0010] c. Once the user creates the models, they can be validated to check the integrity of the models and can be persisted if the validation succeeds, or the relevant error messages are given.

[0011] d. The system developed thus is reusable at different levels and highly extensible.

[0012]FIG. 2 shows the general structure of such a system. The strategy employed in this system is to take the “knowledge” (2.1) of the types of models out of the system, and let the system only have “meta-knowledge” (i.e., knowledge about the knowledge of the types of models) (2.2 a). These will be used by the system to dynamically acquire the knowledge about a particular class of models (i.e., when the user configures the system), and then let the user (2.3) create models conforming to the definitions provided by the acquired knowledge using a GUI (2.2 b). Thus, the system behaves according to the configured modeling environment, which not only includes the semantic information about the types of models that can be created (2.4), but also the visual aspects of the models.

[0013] The complexity in using metamodeling tools arises from the mechanism for providing the metamodeling system with the knowledge about a modeling environment. Specifically, the following requirements need to be addressed:

[0014] 1. How to represent the knowledge about a modeling environment?

[0015] What are the node-types that can appear in models?

[0016] How many nodes of each type can appear in the models?

[0017] What are the edge types that can appear?

[0018] The multiplicity and directionality of the edges.

[0019] 2. How to configure the system with this information?

[0020] 3. How does the system use the provided information to validate the models created by the user?

[0021] Answering all the above mentioned questions precisely for a particular modeling environment (like OOP CASE environment, or a Business Process Reengineering environment) is difficult. It often leads to errors and unforeseen situations occur during modeling, which may lead to legal models being rejected by the system. Existing metamodeling systems do not provide an effective and simple mechanism for addressing these issues.

THE OBJECT AND SUMMARY OF THE INVENTION

[0022] The object of this invention is to avoid the above drawbacks by using examples for constructing the metamodel automatically.

[0023] To achieve the said objective this invention provides a method for generating a metamodel representing a desired modeling environment, characterized in that said metamodel is generated on the basis of examples of target models, comprising:

[0024] extracting information required to construct the metamodel, from said examples, and

[0025] generating a metamodel structure that represents the class of models that all the examples collectively represent.

[0026] The said extraction is performed by:

[0027] viewing each example as a directed multigraph, and

[0028] transforming each said multigraph into strings of symbols that encode the information about the model.

[0029] The said metamodel structure is generated by constructing several finite automata to accept said extracted information.

[0030] The said directed multigraphs are created by:

[0031] identifying nodes and edges and their types occurring in each said example,

[0032] assigning a unique id to each said node and edge, and

[0033] ordering said ids in a defined sequence.

[0034] The said strings of symbols are constructed so as to represent the occurrence and type of nodes as well as the relationships between them in an ordered manner.

[0035] The said examples, including positive examples that provide instances of correct behaviour.

[0036] The said examples further include negative examples that provide instances of incorrect behaviour.

[0037] The said positive examples are used to create finite automata that collectively form a generalization machine that describes the set of rules that define the required behaviour of said metamodel.

[0038] The said negative examples are used to create finite automata that collectively form a specialization machine that describes the set of desired exceptions to a set of rules defining the required behaviour of said metamodel.

[0039] The present invention further provides a system for generating a metamodel representing a desired modeling environment, characterized in that sad metamodel is generated on the basis of examples of target models, comprising:

[0040] means for extracting information required to construct the metamodel, from said examples, and

[0041] means for generating a metamodel structure that represents the class of models that all the examples collectively represent.

[0042] The said means for extraction including:

[0043] means for viewing each example as a directed multigraph, and

[0044] means for transforming each said multigraph into strings of symbols that encode the information about the model.

[0045] The said metamodel structure is generated by means for constructing several finite automata to accept said extracted information.

[0046] The said directed multigraphs are created by;

[0047] means for identifying nodes and edges and their types occurring in each said example,

[0048] means for assigning a unique id to each said node and edge, and

[0049] means for ordering said ids in a defined sequence.

[0050] The said strings of symbols are constructed so as to represent the occurrence and type of nodes as well as the relationships between them in an ordered manner.

[0051] The said examples, including positive examples that provide instances of correct behaviour.

[0052] The said examples further include negative examples that provide instances of incorrect behaviour.

[0053] The said positive examples are used to create finite automata that collectively form a generalization machine that describes the general set of rules defining the desired behaviour for said metamodel.

[0054] The said negative examples are used to create finite automata that collectively form a specialization machine that describes a set of desired exceptions to a set of rules defining the required behaviour of said metamodel.

[0055] The present invention further provides a computer program product comprising computer readable program code stored on computer readable storage medium embodied therein for generating a metamodel representing a desired modeling environment, characterized in that sad metamodel is generated on the basis of examples of target models, comprising:

[0056] computer readable program code means configured for extracting information required to construct the metamodel, from said examples, and

[0057] computer readable program code means configured for generating a metamodel structure that represents the class of models that all the examples collectively represent.

[0058] The said computer readable program code means configured for extraction including:

[0059] computer readable program code means configured for viewing each example as a directed multigraph, and

[0060] computer readable program code means configured for transforming each said multigraph into strings of symbols that encode the information about the model.

[0061] The said metamodel structure is generated by computer readable program code means configured for constructing several finite automata to accept said extracted information.

[0062] The said directed multigraphs are created by:

[0063] computer readable program code means configured for identifying nodes and edges and their types occurring in each said example,

[0064] computer readable program code means configured for assigning a unique id to each said node and edge, and

[0065] computer readable program code means configured for ordering said ids in a defined sequence.

[0066] The said strings of symbols are constructed so as to represent the occurrence and type of nodes as well as the relationships between them in an ordered manner.

[0067] The said examples, including positive examples that provide instances of correct behaviour.

[0068] The said examples further include negative examples that provide instances of incorrect behaviour.

[0069] The said positive examples are used to create finite automata that collectively form a generalization machine that describes the general set of rules defining the desired behaviour for said metamodel.

[0070] The said negative examples are used to create finite automata that collectively form a specialization machine that describes a set of desired exceptions to a set of rules defining the required behaviour of said metamodel.

[0071] In a nutshell, there are two phases of operation—training and production. During training, the user provides several examples, basically of two types—Positive and Negative. These examples are collected and each example is transformed into a set of strings. A set of languages (for node types and edge types) and the corresponding machines, which accept these languages form the metamodel for the modeling environment. A unique approach for constructing Generalization Machine and a composite Specialization Machine for each language is taken, in order to tackle the Generic-Specific dilemma. Positive examples are used to construct the Generalization Machine and Negative examples are used to construct a Specialization Machine. These machines are then used to validate the models during production.

BRIEF DESCRIPTION OF THE DRAWINGS

[0072] The invention will now be described with reference to the accompanying drawings:

[0073]FIG. 1 shows the prior art using conventional modeling.

[0074]FIG. 2 shows the prior art for metamodeling.

[0075]FIG. 3 shows the basic operation of current invention.

[0076]FIG. 4 shows the operation during training.

[0077]FIG. 5 shows one preferred embodiment of the invention.

[0078]FIG. 6 illustrates an example of transformation of a input example into strings.

[0079]FIG. 7 shows examples of nodes in a directed multigraph.

[0080]FIG. 8 shows a relation between Modeling Environment, Types, Languages, and Strings

[0081]FIG. 9 shows an example to illustrate the generic-Specific problem.

[0082]FIG. 10 illustrates the process of generating a metamodel using the positive and negative examples.

[0083]FIG. 11 shows a sample DOFA.

[0084]FIG. 12 illustrates an example showing over generalization.

[0085]FIG. 13 shows a general structure of a Specialization Machine.

[0086]FIG. 14 shows the composite nature of the specialization machine.

[0087]FIG. 15 shows a simple workflow diagram for Problem Analysis in Software Support Processes, as taken in Appendix A

DETAILED DESCRIPTION

[0088]FIGS. 1 and 2 are explained in the background of the invention.

[0089] Referring to FIG. 3, there are two phases in which a Metamodeling by Example (MBE) system operates:

[0090] Training Phase: This is the initial phase, in which a series of examples (3.2) are presented one after another to the system (3.2). The system examines each example and extracts the information required to construct the definition/metamodel (3.3), which represents the class of models that all the examples collectively represent.

[0091] Production Phase: The normal operation of the software, wherein the user is allowed to create models for the environment for which the system (3.5) is trained. The models (3.4) that are created are validated by using the metamodel that was generated during the training phase.

[0092]FIG. 4 describes the learning from examples method of the system:

[0093] As each example [4.1(a) and 4.1(b)], of a particular modeling environment is presented to the system it is converted into a series of directed multigraph representations (4.2). Each directed multigraph is then translated into a set of symbol strings (4.3). As a final step the symbol strings are used to construct a set of finite automata (4.4) or ‘language’ that defines the modeling behaviour.

[0094] A basic architecture for the proposed system is given in FIG. 5:

[0095] A construction component (5.1) provides the required interface for the user to create example models (5.1 a) during training, and the actual models during production. A preprocessor module (5.1 b) is responsible for transforming the models into graphs. The preprocessor operates as follows:

[0096] The system starts with no node-types or edge-types registered for a given modeling environment. As the user creates examples during training, nodes, edges and their types are created. A unique id is associated with every new node/edge type and an icon (the way in which the nodes or edges of that type will be rendered on the screen) is registered for that type in the GUI. The preprocessor component ensures the following:

[0097] 1) The ids that are associated with the node/edge types are unique and can be ordered i.e. if ‘a’ and ‘b’ are any two distinct type ids, either a<b, or a>b are true. Typically, letters from English alphabet are used for node-types and letters from the Greek alphabet are used for edge-types.

[0098] 2) The integrity of type-ids is maintained across examples.

[0099] A Stringifier component (5.2) transforms each graph into a series of strings. The entire graph is scanned and each occurrence of a node and its type is added to a string in the sequence in which it is encountered in the graph. Each node is then considered and two strings, one representing all incoming edges and the other representing all outgoing edges are generated. Each string includes the type of each edge. The Stringifier component generates several strings for each model:

[0100] 1. One string representing the occurrence of node-types in the model, known as the “the node string”. The “node string” is a singleton for a model.

[0101] 2. Two strings per node representing the occurrence of incoming and outgoing edge types. These are known as “in edge string” and the “out edge string”. The ‘in edge string’ represents the occurrence of incoming edge types to a node type, and the ‘out edge string’ represents the occurrence of out going edge types from a node type. The edge strings are associated with a node type.

[0102] The set of strings is used by a definition component (5.3) containing a Definition Builder module (5.3 a) to construct the metamodel during the training phase. A metamodel is a set of finite automata that operates in accordance with a set of definitions of behaviour. The set of behaviour definitions are captured in a set of definition languages. The languages specify the structure and behaviour of the model in terms of strings. The first of these languages is called “Node Language”. This language defines all valid node strings. Each node type in turn has two languages called “In Edge Language” and “Out Edge Language”. The “In-Edge Language” defines valid “in-edge” strings for that particular node type, and the “Out-Edge Language” defines all valid out-edge strings for that node type.

[0103] Thus, if there are ‘N’ node types in a modeling environment, there are (2N+1) languages, where 2N languages are for edges and 1 language is for the nodes. The finite automata are built to accept these languages.

[0104] Once the definition is learnt during training, a Compiler module (5.3 b) in the Definition component (5.3) stores the metamodel constructed and uses it to validate the models produced by the user during production.

[0105]FIG. 6 shows an example of ‘node string’ generation. For the example graph the ‘node string’ is ABACCC as indicated by blocks 6.1, 6.2, 6.3, 6.4, 6.5 and 6.6. This single string for the entire model contains information about the type and sequence of occurrence of nodes.

[0106]FIG. 7 shows two examples of ‘In edge string’ and ‘out edge string’ generation. In (7.1) node ‘A’ has “In-edge string” (A, in, ω) and ‘out edge string’ (A, out, β). In (7.2) node ‘A’ has ‘In edge string’ (A, in, ω) and ‘Out Edge Sting” (A, out, Pφφφ)

[0107]FIG. 8 describes the relationship between the modeling Environment (8.1) and the associated node Language (8.2) with an associated Node String (8.3). Each Node type (8.4) has associated In-edge Language (8.5) and Out-edge Language (8.6). The In-edge language has an associated In-edge string (8.7) while the Out-edge Language has an associated Out Edge String (8.8).

[0108]FIG. 9 shows the approach taken in learning from examples using a workflow model as a case. Data, such as a Problem Report (9.1) triggers an activity related to analysis of the problem (9.2) involving human performers headed by a Team Leader (9.3). the Problem analysis activity also generates a mailing activity (9.4) performed automatically by the Workflow System (9.5).

[0109] There are two extreme approaches to learn or extract the class/definition from examples, namely the Generic and the Specific approaches. Some of the assertions that can be made about the definition from the above example using these two approaches are listed below:

[0110] The Generic Approach:

[0111] 1. There can be one or more Activities in a work flow model.

[0112] 2. An activity may or may not lead to another activity, i.e. be related by the relation “next activity”.

[0113] 3. An activity may have zero or one input data associated with it.

[0114] 4. An activity is associated with zero or one human performer. An activity is associated with zero or one non-human performer. This means that models, where an activity is associated with both human and non-human performers, i.e. with two performers, or activity with no performer associated are also valid.

[0115] The Specific Approach:

[0116] 1. There can be only two activities in a workflow model.

[0117] 2. Only one activity can lead to another activity through the “next activity” relation.

[0118] 3. Only the activity that leads to another activity has input data associated with it, and should be performed by a human performer.

[0119] 4. A non-human performer should always perform the activity that has “next activity” as an incoming edge.

[0120] 5. An activity is either associated with a human performer or a non-human performer; but not both or none.

[0121] In these two approaches, the Generic Approach is superior. It may be desirable that the assertion 4 of the Generic Approach was not made by the system, and in fact be replaced by assertion 5 of the Specific Approach.

[0122]FIG. 10 shows the use of 2 types of examples—namely Positive and Negative. Positive examples are those in which everything is perfectly correct. Negative examples are those in which certain aspects are wrong. Moreover, negative examples need not be complete, but present only those sections of the model that highlight the negative feature. The positive examples are used to generalize the definition by taking the generic approach. Negative examples try to remove certain illegal models, which had become valid due to over-generalization. Thus, every language that was mentioned above would have two machines associated with it, namely—a Generalization Machine and a Specialization Machine. The Generalization Machine is constructed using the positive examples, while the Specialization Machine is constructed using the negative examples.

[0123] To construct the Specialization Machine, the Specific approach is not taken. In fact the approach is no different than that for the Generalization Machine. The reason for calling it Specialization Machine is that it removes several models from the language that the Generalization Machine would have otherwise accepted, thus specializing the definition learnt.

[0124] The input string (10.1) for a language is fed to both the Generalization Machine (10.2 a) and the Specialization Machine (10.2 b) during compilation. It is assumed that these machines output a ‘1’ if they accept the string, and a ‘0’ if they reject the string. Under these conditions, the compilation would be successful when the Generalization Machine accepts the string and the Specialization Machine rejects the string, as indicated by the boolean logic (10.3). This is the reason for constructing the Generalization Machine from positive examples and the Specialization Machine from negative examples.

[0125] The Generalization Machine: The Generalization Machine is a type of Deterministic Finite Automata termed Deterministic Ordered Finite Automata (DOFA). This finite automaton always deals with strings that are ordered using a set of states are also ordered and the alphabet is also virtually ordered. The transition function is modified to reflect this ordering.

[0126] A formal description of the Generalization Machine M_(G) is now presented. M_(G) can be represented as a 5 tuple M_(G)(Q, X, q₀, δ, F) where . . .

[0127] 1. Q is a well-ordered set of states.

[0128] That is, ∀x, yεQ, if x≠y then x<y or x>y; and in any non-empty subset of Q, there is always a smallest element. The condition for x<y ∀x,y εQ, and some more definitions regarding this will be stated later.

[0129] 2. Σ is the well-ordered set of input symbols. Let us call it the ‘Virtual Alphabet’. Again, ∀α, βεΣ, if α≠β then α<β or α>β; and in any non-empty subset of Σ, there is always a smallest element.

[0130] A string is a finite sequence of symbols (from the alphabet) juxtaposed.

[0131] Let us define a set Σ* as the set of strings that can possibly be accepted by a DOFA as follows.

[0132] a. ∀aεΣ, aεΣ*

[0133] b. ∀a, bεΣ, abεΣ*iff a≦b

[0134] c. ∀x, wεΣ* & a, bεΣ|w=bx, then awεΣ*iff a≦b

[0135] d. The only elements in Σ* are those that can be produced from the three rules above.

[0136] Let ‘Ω’ be a special input symbol called ‘Bypass Symbol’.

[0137] Let Σ′=Σ∪{Ω} be the ‘Actual Alphabet’ of the machine M_(G). Here Σ′ is not ordered.

[0138] The specialty of this symbol Ω is that it does not appear in any of the possible input strings that can be accepted by a DOFA (as defined by Σ* above), yet finds a place in the ‘Actual Alphabet’ and thus in δ (the transition function to be described later). This symbol is used for bypassing the dead-ends.

[0139] Two important points to be noted are as follows.

[0140] a. Σ is called the ‘Virtual Alphabet’, because for the outer world, M_(G) accepts strings only in Σ*, which does not contain Ω as a symbol in any string. Yet, the machine internally has Ω as an input symbol in the transitions. Thus Σ′is the ‘Actual Alphabet’.

[0141] b. While characterizing M_(G) as a 5 tuple M_(G)(Q, Σ, q₀, δ, F), the ‘Virtual Alphabet’ Σ is used and not the ‘Actual Alphabet’ Σ′ because Σ′ is derivable from Σ. It is noted that Σ is not derivable from Σ′ because although Σ=Σ′−{Ω}, the ordering in Σ is not maintained. Therefore, the machine is characterized by the ‘Virtual Alphabet’ Σ.

[0142] 3. q₀εQ, and is a designated starting state.

[0143] 4. δ is the transition function. It is a mapping from Q×Σ′ to Q. δ(q, a) is the state to which the machine at state ‘q’ should go to after reading the input symbol ‘a’ from the input tape. The head of the finite control then moves one symbol to the right.

[0144] Thus, δ can be viewed as a set of ordered pairs where the first element of the ordered pair is an ordered pair of a state and an input symbol, and the second element of the ordered pair is a state.

[0145] Thus, ((q, a), p)εδ, if the machine M_(G) in state ‘q’ transitions to state ‘p’ after reading an input symbol ‘a’ from the input tape. Here it is noted that p, qεQ and aεΣ′.

[0146] With this transition function, the automaton behaves like a normal Deterministic Finite Automaton. However, the applicability of the following rule makes this automaton a DOFA. $\underset{\_}{{{Bypass} - {Rule}}\quad}\left( {{‘q’}\quad {is}\quad {the}\quad {current}\quad {state}\quad {and}\quad {‘a’}\quad {is}\quad {the}\quad {current}\quad {input}\quad {symbol}} \right)$ if  ((q, a), p) ∉ d  ∀p ∈ Q&   ∀x ∈ S&∀m ∈ Q, ∄((q, x), m) ∈ d|x > a(in  S)& ((q, Ω), p) ∈ d  ∀p ∈ Qthen  apply  the  transition  d(q, Ω) = p  and  move  to  state  ‘p’.

[0147] This behavior is equivalent to inserting an input symbol ‘Ω’ just before ‘a’ in the input tape. After applying the transition δ(q, Ω)=p and moving to the state ‘p’, the input symbol ‘a’ still remains to be processed because the symbol that was processed in the last transition was the bypass symbol Ω imagined to be inserted before ‘a’.

[0148] 5. F⊂Q. is the set of final states.

[0149] Another transition function δ′ is defined as follows.

[0150] δ′ is a mapping from Q×Y* to Q such that

[0151] 1. δ′(q,w)=δ(q,w) if qδQ & wεΣ* & |w|=1

[0152] 2. δ′(q, wa)=δ(δ′(q, w), a) qεQ, wεΣ* & aεΣ.

[0153] Now, the ordering in set Q before is defined as follows.

[0154] ∀p, qεQ, p<q iffwεΣ*|δ′(q, w)=p.

[0155] Two more entities pertaining to set Q are defined as follows.

[0156] ∀p, qεQ, successor(p)=q iff p<q & rεQ|p<r<q

[0157] ∀p, qεQ, predecessor(q)=p iff p<q & rεQ|p<r<q

[0158] The above definitions imply that if successor(p)=q then predecessor(q)=p.

[0159] An informal description of the machine M_(G) is illustrated by FIG. 11, which shows a sample DOFA, instead of dealing with sets and propositions alone.

[0160] Here, q₀ (11.1) is the starting state indicated by a ‘−’ sign, and q₄ (11.5) is a final state indicated by the ‘+’ sign. Thus Q={q₀, q₁, q₂, q₃, q₄}. The ordering is q₀<q₁<q₂<q₃<q₄ because there are no transitions from q₁ to q₀, or from q₃ to q₂, q₁, q₀ and so on. This is why Q is a well-ordered set. As can be seen from the diagram, the transitions are happening on symbols like α, β, γ, μ, λ and Ω. These together forms the ‘Actual Alphabet’. So, Σ={α, β, γ, λ, Ω}. The ‘Virtual Alphabet’ Σ={α, β, γ, μ, λ}. The meaning of E being well ordered is that a<β<γ<μ<μ. It actually means that there will be no string accepted by any DOFA that has α after β or γ or μ or λ and so on. Hence strings like βαλμ are automatically invalid.

[0161] The transitions for this example machine are

[0162] δ(q₀, α)=q₁

[0163] δ(q₀, Ω)=q₁

[0164] δ(q₁, β)=q₂

[0165] δ(q₂, γ)=q₂

[0166] δ(q₂, μ)=q₃

[0167] δ(q₂, Ω)=q₃

[0168] δ(q₃, λ)=q₄

[0169] δ(q₄, λ)=q₄

[0170] Also, as an example, δ′(q₀, αβγγγ)=q₂ since the transition graph for this input string starting from q₀ terminates in, q₂ after the string is parsed. This is essentially the meaning of δ′.

[0171] In a bypass condition, consider an input string αβγγλ for the example machine. In order to parse this input string, the following sequence of transitions is used. Input String Transition (1) αβγγλ δ(q₀, α) = q₁ (2) αβγγλ δ(q₁, β) = q₂ (3) αβγγλ δ(q₂, γ) = q₂ (4) αβγγλ δ(q₂, γ) = q₂ (5) αβγγλ δ(q₂, Ω) = q₃ (Bypass-Rule) (6) αβγγλ δ(q₃, λ) = q₄

[0172] Since q₄ is a final state, this string will be accepted by the machine. For transitions (3) and (4), the Bypass-Rule δ(q₂, Ω)=q₃ can not be applied because there exists δ(q₂, γ)=q₂; and for (5) the Bypass-Rule δ(q₂, Ω)=q₃ can be applied because there does not exist q, such that ((q₂, λ), q) is in the set of transitions and also there does not exist any q such that ((q₂, x), q) is in the set of transitions and x≧λ (we only have ((q₂, γ), q₂) and ((q₂, μ), q₃) in δ and both γ<λ and μ<λ). It is also noted that between transitions (5) and (6), the pointer on the input tape did not move one step to the right. Finally as an example it is noted that successor(q₁) is q₂ and predecessor(q₄)=q₃ and so on.

[0173] The Generalization Mechanism: As new examples are presented, new strings are produced. The corresponding DOFA has to be updated suitably to accept the new strings, by generalizing as required. As indicated above, a modeling environment has several languages (1 node language and 2N edge languages for N node types) associated with it. Every language has a generalization machine and a specialization machine. The generalization mechanism applies to all Generalization Machines irrespective of what languages are represented and is applied to progressively build the Generalization Machine during the Training Phase.

[0174] The Generalization Mechanism involves parsing the input strings and updating the machine. As already mentioned above, the Generalization Machine is characterized by the 5 tuple. The process attempts to modify each of the elements of the machine as and when required. It may be observed that only the ‘Virtual Alphabet’ is being updated and not the ‘Actual Alphabet’ since it is the Virtual Alphabet that characterizes the machine and the Actual Alphabet is derivable from the Virtual Alphabet.

[0175] The strings are parsed in sequence. Each string is assumed to be placed on an input tape and is read from left to right traversing the transition graph using the transitions given by δ. Traversal may reach a dead-end state because of the following possibilities. (Let ‘d’ be the dead-end state and ‘α’ be the current symbol on the input tape.):

[0176] 1. The machine is still in its initial state (d=q₀). The initial state is when Q={q₀}, Σ={ }, F={ }, and there are no transitions defined at all.

[0177] 2. The final state has been reached, while the input tape is not completely parsed (dεF).

[0178] 3. There is no δ(d, α) defined on d and α, and Bypass-Rule can not be applied because δ(d, Ω)=q transition can not be made because ∃pεQ & βεΣ|δ(d, β)=p & β>α.

[0179] 4. There is no δ(d, α) defined on d and α, and Bypass-Rule can not be applied, because ((d, Ω),p) δ∀pεQ

[0180] Once a dead end is reached, the DOFA is updated according to the following rules. (It is noted that except for case IV listed below, in all other cases, the current pointer on the input tape is advanced one symbol to the right after the steps in the corresponding cases are performed):

[0181] Case I: If the dead end is reached because of possibility 1.

[0182] 1. Add an element p to Q such that successor(q₀)=p.

[0183] 2. Let Σ={α}.

[0184] 3. Let δ(q₀, α)=p.

[0185] 4. Let F={p}.

[0186] 5. Move the pointer one symbol to the right on the input tape.

[0187] Case II: If the dead end is reached because of possibility 2

[0188] a) if δ(predecessor(d), x)=d and x≠c

[0189] 1. Add an element p to Q such that successor(d)=p.

[0190] 2. Let Σ=ΣU{α}such that x<a.

[0191] 3. Let δ(d, α)=p. If it is the first string being fed to the machine, let δ(d, Ω)=p.

[0192] 4. Let F=F−{d}, and F=FU{p}.

[0193] 5. Move the pointer one symbol to the right on the input tape.

[0194] b) if δ(predecessor(d), α)=d then δ(d, α)=d and move the pointer one symbol to the right on the input tape.

[0195] Case III: If the dead end has been reached because of possibility 3

[0196] a) if δ(predecessor(d), α)=d then δ(d, α)=d and move the pointer one symbol to the right on the input tape.

[0197] b) if δ(predecessor(d), x)=d and x≠α

[0198] 1. Add new state p to Q such that

[0199] Successor(p)=Successor(d);

[0200] Successor(d)=p;

[0201] 2. ∀βεΣ & rεQ replace all δ(d, β)=r by δ(p, β)=r.

[0202] 3. Let Σ=ΣU {α} such that α>x & ayεΣ|α>y>x.

[0203] 4. Let δ(d, α)=p & δ(d, Ω)=p.

[0204] 5. Move the pointer one symbol to the right on the input tape.

[0205] Case IV: If the dead end has been reached because of possibility 4 let δ(d, Ω)=successor(d), and do not move the pointer one symbol to the right on the input tape.

[0206] Informally, the generalization machine tries to promote the multiplicity of symbols occurring in the strings as follows . . .

[0207] 0→1 or * or +

[0208] 1→+ or *

[0209] Where * means zero or one occurrence and + means one or more occurences.

[0210] The rules listed above are graphically represented in the following table: Extra Before Rule Case Subcase Condition Application After Rule Application I MG still in initial state

II a x ≠ α and it is the first string being fed to the machine as an example.

x ≠ α and it is not the first string

b x = α

III a x ≠ αx < αy > α

b x = αy > α

IV y <αx <α

[0211] The Specialization Machine M_(S) is very similar to the Generalization machine. This machine is built by using the negative examples. An additional rule for the transition function δ is added, which should be used only during production (and not during training). This rule, which is called s-bypass-rule (for specialization bypass rule), is as follows . . .

[0212] ∀α, βεΣ & p, qεQ, δ(q, α)=q if (( q, α), p)δ & ((q, β), p)εδ|α<β.

[0213] During training, M_(S) is exactly the same as M_(G). As mentioned earlier, negative examples need not be complete. This implies that the negative examples only highlight the undesirable parts of the model, which gets translated into undesirable types of strings after the transformation. The problem therefore is to ensure that these types of strings do not occur during production.

[0214] As an example, consider the following DOFA and the corresponding Regular Expression representing the edge language. (Note that a regular expression is equivalent to a Deterministic Finite Automaton. Hence, a DOFA or the Generalization Machine can be represented by a Regular Expression.)

[0215] (α+Ω)βγ*(μ+Ω)λ⁺

[0216]FIG. 12 illustrates an example showing over-generalization. The above generalization indicates that

[0217] 1. Zero or one occurrence of the edge type α is permitted (as shown against 12.1).

[0218] 2. The edge type β has exactly one instance for nodes of this node type (12.2).

[0219] 3. Zero or more edges of type γ may be present (12.3).

[0220] 4. Zero or one edge of type μ is permitted (12.4).

[0221] 5. At least one edge of type λ should be present (12.5).

[0222] During the Generalization Mechanism, each node and each edge is treated individually. The relations with other edges/nodes and dependencies are not considered, hence over generalization occurs.

[0223] Assume that the above DOFA has over generalized, and that the user does not want the edge types α & μ to occur together. In other words, strings like αβγγγμλ and αβμλλλ, which are acceptable in the language L(M_(G)), which are to be disallowed. The user creates a negative example for a node type in which edges of both type α and μ are present.—a string containing αμ.

[0224] The task is to build a machine, which accepts all strings in L(M_(G)) having both α and μ not necessarily appearing adjacently. This new language is called L(M_(S)) and the machine which accepts this language is called the Specialization Machine M_(S). M_(S) exists primarily to handle these dependencies between different types.

[0225]FIG. 13 shows a general structure of a specialization machine.

[0226] Suppose x_(I) (13.2), x_(j) (13.4), and x_(k) (13.6) are the three types whose dependencies are handled by this specialization machine. The ovals containing x_(i), x_(j), x_(k) represent that parts of M_(S) that handle these symbols.

[0227] For example,

[0228] Part x_(i)→(x_(i)+Ω)

[0229] Part x_(j)→x_(j);

[0230] Part x_(k)→x_(k) ⁺

[0231] The other parts of the machine allow any other intermediate symbol to be bypassed by using the s-bypass condition. The box represented by A thus allows all symbols before xi to be discarded. Hence,

[0232] Box A (13.1)→(x₁+x₂+ . . . +x_(i−1))*

[0233] Box B (13.3)→(X_(i+1)+X_(i+2)+ . . . +x_(j−1))*

[0234] Box C (13.5)→(x_(j+1)+x_(j+2)+ . . . +x_(k−1))*

[0235] Box D (13.7)→(x_(k+1)+x_(k+2)+ . . . x_(n))*

[0236] Here the virtual alphabet Σ={x₁, x₂, . . . x_(n)} and 1≦i<j<k≦n.

[0237] The Specialization Mechanism, as mentioned before is the same as the Generalization Mechanism. Hence M_(S) is the same as M_(G) during training.

[0238] A negative feature is an undesirable element that could have possibly been learnt by the system due to over generalization of M_(G). If a negative feature is associated with a node type it deals with the dependencies between the edges of that node type; or it may be associated with the entire model in which case it will be dealing with the dependencies between the nodes of different types. A single negative feature may be exemplified to the system by means of several negative examples. These negative examples are used to build M_(S) for that negative feature. There is one M_(S) for each negative feature. Hence the Specialization Machine is actually made up of several M_(S), one for each negative feature.

[0239]FIG. 14, illustrates the composite nature of the specialization machine. The Total Specialization Machine is a Non-Deterministic Finite Automaton due to the existence of ε-transitions. This is required because even if one of the negative features for that language is satisfied, the compilation should fail.

[0240] Computer Implementation of the concepts presented here is readily achievable. The Deterministic Ordered Finite Automaton (DOFA), is a specialized Finite Automaton (FA). A FA is a fundamental entity in Computer Science used in several applications like lexical analysis, implementation of text editors, compilers etc. Thus, the implementation of a FA is well known. Since a DOFA only employs certain special rules to be invoked and conditions to be checked during the operation of the machine, it does not present any implementation difficulties not found in FA. Thus it can be safely asserted that computer implementation of the method presented is straightforward.

[0241] Worked Example:

[0242]FIG. 15 shows a worked example illustrating the construction of the Generalization Machine using the Generalization Mechanism and one example illustrating the construction of the Specialization Machine for a negative feature.

[0243] Consider that the user gives the following model as a positive example to the system and that this is the first example.

[0244] Let us say that while collecting examples, the following symbols are assigned to the types.

[0245] Node Types:

[0246] Activity→a

[0247] Human Performer→b

[0248] Non Human Performer→c

[0249] Data→d

[0250] Decision→e

[0251] Note that a<b<c<d<e

[0252] Edge Types:

[0253] Next activity→α

[0254] Performed by human performer→β

[0255] Performed by non human performer→γ

[0256] Data→χ

[0257] Into decision→d

[0258] Yes decision→φ

[0259] No decision→η

[0260] Note that α<β<γ<χ<d<φ<η

[0261] The strings that are obtained from this model after the transformation are . . .

[0262] Node String: aaaabbbcddde

[0263] Edge Strings:

[0264] (a, in, χ)

[0265] (a, in, φ)

[0266] (a, in, η)

[0267] (a, in, αχ)

[0268] (a, out, βd)

[0269] (a, out, β)

[0270] (a, out, αγ)

[0271] (a, out, βχ)

[0272] (b, in, β)

[0273] (b, in, β)

[0274] (b, in, β)

[0275] (c, in, γ)

[0276] (d, in, χ)

[0277] (d, out, χ)

[0278] (d, out, χ)

[0279] (e, in, d)

[0280] (e, out, φη)

[0281] The following are the languages to be developed now.

[0282] 1. Node Language

[0283] 2. In Edge Language for a

[0284] 3. Out Edge Language for a

[0285] 4. In Edge Language for b

[0286] 5. Out Edge Language for b

[0287] 6. In Edge Language for c

[0288] 7. Out Edge Language for c

[0289] 8..hi Edge Language for d

[0290] 9. Out Edge Language for d

[0291] 10. In Edge Language for e

[0292] 11. Out Edge Language for e

[0293] Since there are 5 node types, 2*5+1=11 languages are to be processed. Out of these languages, the Out Edge Languages for node types b and c (5 and 7 in the above list) can be neglected because there are no edges going out of nodes of this type. Therefore, 9 machines are to be developed to accept these languages. The Generalization Mechanism is now applied here for each machine. A detailed step by step procedure for one language is presented in the following table.

[0294] 1. Language: Node Language. String: aaaabbbcddde Input tape Transition Graph when the before applying the rule Transition Graph after dead end is and the rule that is the application of the reached M(Q, Σ, δ, q₀, F) applied. rule. aaaabbbcddde Q = {q₀}Σ= {}F = {}

aaaabbbcddde Q = {q₀, q₁}Σ= {a}F = {q₁}

aaaabbbcddde Q = {q₀, q₁}Σ= {a}F = {q₁}

aaaabbbcddde Q = {q₀, q₁, q₂}Σ= {a, b}F = {q₂}

aaaabbbcddde Q = {q₀, q₁, q₂}Σ= {a, b}F = {q₂}

aaaabbbcddde Q = {q₀, q₁, q₂, q₃}Σ= {a, b, c}F = {q₃}

aaaabbbcddde Q = {q₀, q₁, q₂, q₃, q₄}Σ= {a, b, c, d}F = {q₄}

aaaabbbcddde Q = {q₀, q₁, q₂, q₃, q₄, q₅}Σ= {a, b, c, d}F = {q₄}

[0295] So the node language developed is

[0296] Q{q₀, q₁, q₂, q₃, q₄, q₅}

[0297] Σ={a, b, c, d, e}

[0298] F={q₅}

[0299] The transition function can be learnt from the following final transition graph.

[0300] The strings and final machine definition for the remaining languages are given below:

[0301] 2. Language: In Edge Language for Node Type a

[0302] The strings are

[0303] 1. χ

[0304] 2. φ

[0305] 3. η

[0306] 4. αχ

[0307] With these strings, the Generalization Mechanism produces the following DOFA.

[0308] Q={q₀, q₁, q₂, q₃, q₄}

[0309] Σ={α,χ,φ,η}

[0310] F={q₄}

[0311] The transitions are as given in the following transition diagram.

[0312] The sequence of rules that are applied are . . .

[0313] 1. I

[0314] 2. IV

[0315] 3. IIa

[0316] 4. IV

[0317] 5. IIa

[0318] 6. IIIa

[0319] 3. Language: Out Edge Language for Node Type a

[0320] The strings are

[0321] 1. βd

[0322] 2. β

[0323] 3. αγ

[0324] 4. βχ

[0325] With these strings, the Generalization Mechanism produces the following DOFA.

[0326] Q={q₀, q₁, q₂, q₃, q₄, q₅}

[0327] Σ={,α,β,γ,χ,d}

[0328] F={q₅}

[0329] The transitions are as given in the following transition diagram.

[0330] 4. Language: In Edge Language for Node Type b

[0331] The strings are

[0332] 1. β

[0333] 2. β

[0334] 3. β

[0335] With these strings, the Generalization Mechanism produces the following DOFA.

[0336] Q={q₀, q₁}

[0337] Σ={β}

[0338] F={q₁}

[0339] The transitions are as given in the following transition diagram.

[0340] 5. Language: Out Edge Language for Node Type b

[0341] There are no strings for this language and hence the machine is

[0342] Q={q₀}

[0343] Σ={ }

[0344] F={ }

[0345] The transitions are as given in the following transition diagram.

[0346] 6. Language: In Edge Language for Node Type c

[0347] The strings are

[0348] 1. γ

[0349] With these strings, the Generalization Mechanism produces the following DOFA.

[0350] Q={q₀, q₁}

[0351] Σ={γ}

[0352] Σ={q₁}

[0353] The transitions are as given in the following transition diagram.

[0354] 7. Language: Out Edge Language for Node Type c

[0355] There are no strings for this language and hence the machine is

[0356] Q={q₀}

[0357] Σ={ }

[0358] F={ }

[0359] The transitions are as given in the following transition diagram.

[0360] 8. Language: In Edge Language for Node Type d

[0361] The strings are

[0362] 1. χ

[0363] With these strings, the Generalization Mechanism produces the following DOFA.

[0364] Q={q₀, q₁}

[0365] Σ={χ}

[0366] F={q₁}

[0367] The transitions are as given in the following transition diagram.

[0368] 9. Language: Out Edge Language for Node Type d

[0369] The strings are

[0370] 1. χ

[0371] 2. χ

[0372] With these strings, the Generalization Mechanism produces the following DOFA.

[0373] Q={q₀, q₁}

[0374] Σ={χ}

[0375] F={q₁}

[0376] The transitions are as given in the following transition diagram.

[0377]10. Language: In Edge Language for Node Type e

[0378] The strings are

[0379] 1. d

[0380] With these strings, the Generalization Mechanism produces the following DOFA.

[0381] Q={q₀, q₁}

[0382] Σ={d}

[0383] F={q₁}

[0384] The transitions are as given in the following transition diagram.

[0385] 11. Language: Out Edge Language for Node Type e

[0386] The strings are

[0387] 1. φη

[0388] With these strings, the Generalization Mechanism produces the following DOFA.

[0389] Q={q₀,q₁,q₂}

[0390] Σ={φ,η}

[0391] F={q₂}

[0392] The transitions are as given in the following transition diagram.

[0393] This is just the first example given to the system. A complete definition for a modeling environment requires the user to provide a sufficient number of varied examples.

[0394] The following is a negative example for building the Specialization Machine.

[0395] The string produced here is (a, out, βγ)

[0396] The Specialization Machine constructed for this language is therefore

[0397] M_(S)(Q, Σ, q₀, δ, F) where . . .

[0398] Q={q₀, q₁, q₂}

[0399] Σ={β,γ}

[0400] F={q₂}

[0401] The transition diagram is as follows.

[0402] During production M_(S) has the s-bypass condition that can be applied, and in this way, it will become very much different from M_(G). So, the Out Edge Language for Node Type a, after the Specialization is made would took as follows.

[0403] Complete machine for out edge language for node type ‘a’ 

1. A method for generating a metamodel representing a desired modeling environment, characterized in that said metamodel is generated on the basis of examples of target models, comprising: extracting information required to construct the metamodel, from said examples, and generating a metamodel structure that represents the class of models that all the examples collectively represent.
 2. The method as claimed in claim 1, wherein said extraction is performed by: viewing each example as a directed multigraph, and transforming each said multigraph into strings of symbols that encode the information about the model.
 3. The method as claimed in claim 1, wherein said metamodel structure is generated by constructing several finite automata to accept said extracted information.
 4. The method as claimed in claim 2, wherein said directed multigraphs are created by: identifying nodes and edges and their types occurring in each said example, assigning a unique id to each said node and edge, and ordering said ids in a defined sequence.
 5. The method as claimed in claim 2, wherein said strings of symbols are constructed so as to represent the occurrence and type of nodes as well as the relationships between them in an ordered manner.
 6. The method as claimed in claim 1, wherein said examples, including positive examples that provide instances of correct behaviour.
 7. The method as claimed in claim 1, wherein said examples further include negative examples that provide instances of incorrect behaviour.
 8. The method as claimed in claim 6, wherein said positive examples are used to create finite automata that collectively form a generalization machine that describes the set of rules that define the required behaviour of said metamodel.
 9. The method as claimed in claim 7, wherein said negative examples are used to create finite automata that collectively form a specialization machine that describes the set of desired exceptions to a set of rules defining the required behaviour of said metamodel.
 10. A system for generating a metamodel representing a desired modeling environment, characterized in that sad metamodel is generated on the basis of examples of target models, comprising: means for extracting information required to construct the metamodel, from said examples, and means for generating a metamodel structure that represents the class of models that all the examples collectively represent.
 11. The system as claimed in claim 10, wherein said means for extraction including: means for viewing each example as a directed multigraph, and means for transforming each said multigraph into strings of symbols that encode the information about the model.
 12. The system as claimed in claim 10, wherein said metamodel structure is generated by means for constructing several finite automata to accept said extracted information.
 13. The system as claimed in claim 11, wherein said directed multigraphs are created by: means for identifying nodes and edges and their types occurring in each said example, means for assigning a unique id to each said node and edge, and means for ordering said ids in a defined sequence.
 14. The system as claimed in claim 11, wherein said strings of symbols are constructed so as to represent the occurrence and type of nodes as well as the relationships between them in an ordered manner.
 15. The system as claimed in claim 10, wherein said examples, including positive examples that provide instances of correct behaviour.
 16. The system as claimed in claim 10, wherein said examples further include negative examples that provide instances of incorrect behaviour.
 17. The system as claimed in claim 15, wherein said positive examples are used to create finite automata that collectively form a generalization machine that describes the general set of rules defining the desired behaviour for said metamodel.
 18. The system as claimed in claim 16, wherein said negative examples are used to create finite automata that collectively form a specialization machine that describes a set of desired exceptions to a set of rules defining the required behaviour of said metamodel.
 19. A computer program product comprising computer readable program code stored on computer readable storage medium embodied therein for generating a metamodel representing a desired modeling environment, characterized in that sad metamodel is generated on the basis of examples of target models, comprising: computer readable program code means configured for extracting information required to construct the metamodel, from said examples, and computer readable program code means configured for generating a metamodel structure that represents the class of models that all the examples collectively represent.
 20. The computer program product as claimed in claim 19, wherein said computer readable program code means configured for extraction including: computer readable program code means configured for viewing each example as a directed multigraph, and computer readable program code means configured for transforming each said multigraph into strings of symbols that encode the information about the model.
 21. The computer program product as claimed in claim 19, wherein said metamodel structure is generated by computer readable program code means configured for constructing several finite automata to accept said extracted information.
 22. The computer program product as claimed in claim 19, wherein said directed multigraphs are created by: computer readable program code means configured for identifying nodes and edges and their types occurring in each said example, computer readable program code means configured for assigning a unique id to each said node and edge, and computer readable program code means configured for ordering said ids in a defined sequence.
 23. The computer program product as claimed in claim 20, wherein said strings of symbols are constructed so as to represent the occurrence and type of nodes as well as the relationships between them in an ordered manner.
 24. The computer program product as claimed in claim 20, wherein said examples, including positive examples that provide instances of correct behaviour.
 25. The computer program product as claimed in claim 19, wherein said examples further include negative examples that provide instances of incorrect behaviour.
 26. The computer program product as claimed in claim 24, wherein said positive examples are used to create finite automata that collectively form a generalization machine that describes the general set of rules defining the desired behaviour for said metamodel.
 27. The computer program product as claimed in claim 25, wherein said negative examples are used to create finite automata that collectively form a specialization machine that describes a set of desired exceptions to a set of rules defining the required behaviour of said metamodel. 